<template>
  <div id="demand-main">
     <main-search ref="mainsearch" :key="$route.fullPath" @demand='denewmodel'/>
    <main-exhibition :hardware='dehardware' :scene='descene' :shop='deshop' :model='demodel'/>
    <tabs-context :shows='deshow' ref="demandtabs" :url="backDemand"/>
  </div>
</template>
<script>
import TabsContext from '../../components/common/tabscontext/TabsContext.vue'
import MainSearch from '../../components/content/search/MainSearch.vue'
import {getDemandAllData} from 'api/demand.js'
import MainExhibition from '../../components/content/exhibition/MainExhibition.vue'
export default {
  name:'DemandMain',
  data(){
    return {
      path:'',
      deshow:[],
      backDemand:'/demand/detail/',
      dehardware:['算法','硬件'],
      demodel:['企业','个人'],
      descene:['已完成','未完成'],
      deshop:['全国','北京市','天津市','广东省']
    }
  },
  components:{
    MainSearch,
    TabsContext,
    MainExhibition
  },
  created(){
    this.AllData();
  },
  methods:{
    AllData(){
       getDemandAllData('/api/request/listAllRequest').then(res=>{
    this.$refs.demandtabs.label1='发布时间';
    this.$refs.demandtabs.label2='投标人数';
    this.$refs.demandtabs.label3='浏览人数';
    this.deshow=res.data;
    this.debid=res.data.bid;
    this.debrowse=res.data.browse;
       }).catch(err=>{
        this.$Notice.error({
        title:'请求失败',
        duration:5})   
       });
    },
    denewmodel(value){
      this.deshow=value;
    }
  },
  mounted(){
    this.$refs.mainsearch.placeholder='输入关键字查找相关需求';
    this.$refs.mainsearch.searchtype='demand';
  }
}
</script>